﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>三维台区</title>
    <script type="text/javascript" src="../Scripts/Libs/SuperMap/include.js"></script>
<!--
    <script type="text/javascript" src="../Scripts/Libs/SuperMap/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="../Scripts/Libs/SuperMap/SuperMap.Web.js"></script>
    <script type="text/javascript" src="../Scripts/Libs/SuperMap/SuperMap.Web.iServerJava6R.js"></script>
    <script type="text/javascript" src="../Scripts/Libs/SuperMap/SuperMap.Web.Realspace.js"></script>
    -->
    <script type="text/javascript">
    
        var sceneControl = null;
        var scene = null;
        var htmlUrl = "http://localhost:8090";

        function onPageLoad() {
            //初始化三维场景控件
            try {
                //初始化三维场景控件实例,参数为包含控件的HTML元素
                sceneControl = new SuperMap.Web.UI.Controls.SceneControl($get("globalMap"), initCallback, failedCallback);
            }
            catch (e) {
                //若没有安装插件，则抛出该异常
                if (e.name == SuperMap.Web.Realspace.ExceptionName.PlugInNotInstalled) {
                    var url = htmlUrl + "/iserver/iClient/forRealspace/Setup.exe";
                    document.write(" <a href='" + url + "'>请点击下载SuperMapiClientForRealspace插件进行安装 </a>");
                    return;
                }
                //若使用非IE浏览器，则抛出该异常
                else if (e.name == SuperMap.Web.Realspace.ExceptionName.BrowserNotSupport) {
                    document.write(" <p>SuperMap iClient 6R for Realspace目前只支持IE浏览器 </p>");
                    return;
                }
                //抛出其他异常
                else {
                    alert(e.message);
                }
            }
        }

        //控件初始化完成后的回调函数，初始化完成之后才能进行数据加载             
        function initCallback() {
            //获取Realspace控件的场景，控件和场景是一对一的捆绑关系
            scene = sceneControl.get_scene();

            //新建一个照相机对象，把照相机的位置设置为中国的中心点
            var camera = new SuperMap.Web.Realspace.Camera(104.348, 28.708, 6378140);

            //将场景的视点移动到中国区域
            scene.get_flyingOperator().flyTo(camera);
        }

        //控件初始化失败后的回调函数
        function failedCallback() {
            alert("Realspace initialized failed!");
        }

    </script>
</head>
<body onload="onPageLoad()" >
    <div id="globalMap" style="height:100%;width:100%;"></div>
</body>
</html>
